<!-- 售后退款 -->
<script setup>
import { ref, reactive } from 'vue'
// props
const props = defineProps({
  show: {
    type: Boolean,
    required: true
  },
  data: {
    type: Array,
    default: () => []
  }
})
// emits
const emit = defineEmits(['close', 'confirm'])

// 数据
const data = reactive({
  value: '',
  remark: ''
})
// 单选列表
const radiolist = [
  {
    name: '买错了'
  },
  {
    name: '发现其它同款低价商品'
  },
  {
    name: '其他'
  }
]
// 关闭弹窗
const close = () => {
  reset()
  emit('close')
}
// 还原初始数据
const reset = () => {
  data.value = ''
  data.remark = ''
}
// 确认退款
const sureRefund = () => {
  emit('confirm')
}
</script>
<script>
export default {
  options: { styleIsolation: "shared" },
};
</script>
<template>
  <!-- 弹窗-选择商品 -->
  <up-popup :show="props.show" :closeable="true" @close="close" :round="10">
    <view class="Refund-module">
      <view class="title">
        <text>售后退款</text>
      </view>
      <view class="cnt">
        <up-radio-group v-model="data.value" placement="column" inactiveColor="#666666" activeColor="#FFC870">
          <up-radio :customStyle="{ marginBottom: '32rpx' }" v-for="(item, index) in radiolist" :key="index"
            :label="item.name" :name="item.name">
          </up-radio>
        </up-radio-group>
        <up-textarea v-model="data.remark" placeholder="请说明理由（0/200）"></up-textarea>
      </view>
      <!-- 底部栏 -->
      <view class="bottom-bar">
        <view class="content">
          <up-button class="sure-btn" text="确认退款" type="primary" shape="circle" @click="sureRefund"></up-button>
          <up-button class="cancel-btn" text="取消" type="primary" shape="circle" :plain="true"
            @click="close"></up-button>
        </view>
      </view>
    </view>
  </up-popup>
</template>

<style lang="scss" scoped>
.Refund-module {
  padding-bottom: 128rpx;

  // 标题
  & .title {
    margin-top: 30rpx;
    font-weight: 500;
    font-size: 36rpx;
    color: #303133;
    text-align: center;
  }

  // 内容
  & .cnt {
    padding: 56rpx 44rpx;

  }

  // 底部栏
  & .bottom-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 172rpx;
    background: #FFFFFF;
    border-top: 1rpx solid #E9E9EB;

    &::v-deep .content {
      display: flex;
      align-items: center;
      justify-content: space-between;
      box-sizing: border-box;
      padding: 12rpx 40rpx;

      & .u-button {
        height: 88rpx;
        width: 312rpx;
        font-weight: 500;
        font-size: 32rpx;
        border-radius: 112rpx;

        &:first-child {

          color: #FFFFFF;
          background: #FFA618;
          border: none;
        }

        &:last-child {
          color: #9B9B9B;
          border: 2rpx solid #9B9B9B;
        }
      }
    }
  }

  // 赠送弹窗文字
  & .sure-give-modal {
    margin-top: 20rpx;

    & view {
      font-weight: 400;
      font-size: 28rpx;
      color: #333333;
      line-height: 40rpx;
      text-align: center;
    }
  }
}
</style>